package com.springboot.frame.starter.csrf;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.HashSet;

public final class MethodCsrfMatcher implements CsrfMatcher {

  private final HashSet<String> allowedMethods = new HashSet<>(
      Arrays.asList("GET", "HEAD", "TRACE", "OPTIONS"));

  @Override
  public boolean matches(HttpServletRequest request) {
    return !this.allowedMethods.contains(request.getMethod());
  }

}
